<template>
  <div>
    <div v-if="!postList" style="text-align:center;font-size: x-large;height: 200px;line-height: 200px;">
      动态空空如也(T＿T)
    </div>
    <post-list v-else :post-list="postList"/>
  </div>
</template>

<script>
import PostList from '@/components/PostList'
import { getUserPost } from '@/api/post'

export default {
  components: { PostList },
  data () {
    return {
      postList: []
    }
  },
  created () {
    this.getUserPost()
  },
  methods: {
    // 获取用户帖子
    async getUserPost () {
      const res = await getUserPost(this.$route.query.id)
      this.postList = res.postList
    }
  }
}
</script>

<style scoped>

</style>
